package indi.zn.commons.serialno;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
/**  
*
*  
* @author 周楠
* @Description: 
* @date 2017年10月24日
*
*/
public interface SeqPersistenceService {

	@Insert(value="INSERT INTO BASE_SEQUENCE (\"ID\", \"SEQ_NAME\", \"CURRENT\", \"BEGIN\",	\"STEP\", \"RANGE\", \"CASHE_SIZE\") VALUES (#{id}, #{name} , #{current}, #{begin}, #{step}, #{range},#{casheSize})")
   void	create(Sequence seq);
	
	
	@Insert(value="INSERT INTO BASE_SEQUENCE (id, seq_name, `current`, `begin`,	step, `range`, cashe_size) VALUES (#{id}, #{name} , #{current}, #{begin}, #{step}, #{range},#{casheSize})")
	 void	createMysql(Sequence seq);

   @Update(value="UPDATE BASE_SEQUENCE SET  current= #{seq.current,jdbcType=INTEGER} WHERE SEQ_NAME =#{seq.name}")
   void merge(@Param("seq") Sequence seq);
   
  // @Select(value="select seq.SEQ_NAME \"name\",seq.\"CURRENT\",seq.\"BEGIN\",seq.\"STEP\",seq.\"RANGE\" ,seq.CASHE_SIZE  from BASE_SEQUENCE seq where  SEQ_NAME=#{0}")
   
   @Select(value="select seq.seq_name \"name\",seq.current ,seq.`begin` ,seq.step ,seq.`range` ,seq.cashe_size  from BASE_SEQUENCE seq where  seq_name=#{0}") 
   Sequence regress(String seqname);
	
}
